

<template>
  <FormPreview v-if="show"></FormPreview>
</template>
<script>
import FormPreview from "./form/components/FormPreview/index.vue";
import {getAction} from "../../../utils/request";

export default {
  name: "ShowJson",
  components:{
    FormPreview
  },
  props:{
    id:{
      type:String
    }
  },
  data(){
    return {
      show:false
    }
  },
  mounted() {
    getAction('/demo/form/' + this.id).then(res=>{
      if(res.data.formJson){
        this.$store.dispatch("formGen/SET_LAYOUTS",JSON.parse(res.data.formJson));
        this.show = true;
        return;
      }
      this.$message.warning("没有配置表单项")
    })
  },
}
</script>
<style scoped lang="scss">

</style>
